
        function goAjax(url, request, async, sfn, efn) {
            url = "/smart-policykeeper-service" + url;
            $.ajax({
                url: url,
                type: "POST",
                data: JSON.stringify(request),
                async: async,
                timeout: 60000,
                dataType: 'json',
                contentType: 'application/json;charset=utf-8',
                beforeSend: function (request, async) {
                    //        	lxRobotBridge && lxRobotBridge.listenStop();
                    if (async.async) {
                        showLoading();
                    }
                },
                success: function (data) {
                    //        	lxRobotBridge && lxRobotBridge.listenStart();
                    if (async) {
                        hideLoading();
                    }
                   let response = data;
                    if (response && response.resCode == "9999") {
                        var t = "您未正确登录或会话已失效，请正确登录后继续操作!";

                    } else {
                        sfn(response);
                    }
                },
                error: function () {
                    //        	lxRobotBridge && lxRobotBridge.listenStart();
                    hideLoading();
                    if (typeof (efn) != "undefined" && efn != '' && efn != null) {
                        efn();
                    } else {
                        //                alert('哎呀，系统出错啦！',"<span data-voiceCmd='LX00003'>确定</span>");
                    }
                }
            });
        };
        /*
        * 没有loading的ajax,有些提交事件 有连续调用接口的逻辑，
        * 单独的loading有断断续续loading的过程,体验不好,这种情况下loading的开关手动控制
        * 保留异常情况下的hideloading调用
        */
        function useAjax(url, request, async, sfn, efn) {
            url = "/smart-counter/api/" + url;
            $.ajax({
                url: url,
                type: "POST",
                data: JSON.stringify(request),
                async: async,
                dataType: 'json',
                contentType: 'application/json;charset=utf-8',
                beforeSend: function (request, async) {
                    //        	lxRobotBridge && lxRobotBridge.listenStop();
                },
                success: function (data) {
                    //        	lxRobotBridge && lxRobotBridge.listenStart();
                    response = data;
                    //            if(response && response.resCode=="p9999"){
                    //            	var t = "您未正确登录或会话已失效，请正确登录后继续操作!";
                    //            	hideLoading();
                    //            }else{
                    //            	sfn(response);
                    //            }
                },
                error: function () {
                    //        	lxRobotBridge && lxRobotBridge.listenStart();
                    hideLoading();
                    //            if(typeof(efn) != "undefined" && efn != '' && efn != null){
                    //                efn();
                    //            } else {
                    //                alert('哎呀，系统出错啦！',"<span data-voiceCmd='LX00003'>确定</span>");
                    //            }
                }
            });
        };
        //获取url中的param参数
        function GetRequest() {
            var url = location.search; //获取url中"?"符后的字串  
            var theRequest = new Object();
            if (url.indexOf("?") != -1) {
                var str = url.substr(1);
                 let strs = str.split("&");
                for (var i = 0; i < strs.length; i++) {
                    theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
                }
            }

            return theRequest;
        }
        //判断字符窜是否为空
        function isStrEmpty(str) {
            if ("" == str || str == null) {
                return true;
            }
            return false;
        }
        /**弹出框**/
        var _alert = window.alert;
        window.alert = Alert;
        function Alert(str, btnText, callback) {//新增  两个参数 btnText 按钮的显示文本,关闭弹框后回调函数
            if (jQuery.isFunction(btnText)) {
                callback = btnText;
                btnText = null;
            }
            var textObj = $('<div class="open-block alertDiv warning"><h4 class="open-header"></h4><div class="open-body text-center" style="word-break: break-all;"><span class="left">'
                + str + '</span></div>');
            var btnObj = $('<div class="open-footer" style="background-color: #005acb;"><span class="btn btn-ok">确认</span></div>');
            textObj.attr('id', 'alertDiv');
            btnObj.attr('id', 'closeBtn');
            if (btnText) {
                btnObj.find("span").html(btnText);
            }
            btnObj.on('click', function () {
                closeDiv('alertDiv');
                $(".alertDiv").remove();
                if (callback) {
                    callback();
                }
            });
            btnObj.appendTo(textObj);
            setTimeout(function () {
                textObj.appendTo("body");
                showDiv('alertDiv');
            }, 200);
        }
        function alertC(str, btnText, callback) {//右上角带 X 按钮的alert， 点X 关闭后不执行回调函数
            if (jQuery.isFunction(btnText)) {
                callback = btnText;
                btnText = null;
            }
            var textObj = $('<div class="open-block alertDiv warning"><span class="close_alert_icon"></span><h4 class="open-header"></h4><div class="open-body text-center" style="word-break: break-all;"><span class="left">'
                + str + '</span></div>');
            var btnObj = $('<div class="open-footer" style="background-color: #005acb;"><span class="btn btn-ok">确认</span></div>');
            textObj.attr('id', 'alertDiv');
            btnObj.attr('id', 'closeBtn');
            if (btnText) {
                btnObj.find("span").html(btnText);
            }
            btnObj.on('click', function () {
                closeDiv('alertDiv');
                $(".alertDiv").remove();
                if (callback) {
                    callback();
                }
            });
            textObj.find(".close_alert_icon").on('click', function () {
                closeDiv('alertDiv');
                $(".alertDiv").remove();
            });
            btnObj.appendTo(textObj);
            setTimeout(function () {
                textObj.appendTo("body");
                showDiv('alertDiv');
                $('#popupLayerScreenLocker').css({'height': '100vh'});
                $('#alertDiv').css('left', '8.5%');
                $('#alertDiv').css('width', '83%');
            }, 200);
        }
        function closeAlert() {
            closeDiv('alertDiv');
            $("#alertDiv").remove();
        }
        window.confirm = myComfirm;
        function myComfirm(str, cancelText, okText, callback) {//关闭弹框后回调函数
            if (jQuery.isFunction(cancelText)) {
                callback = cancelText;
                cancelText = "取消";
                okText = "确定";
            }
            var textObj = $('<div class="open-block warning confirmDiv"><h4 class="open-header">提示</h4><div class="open-body text-center" style="text-align:justify;word-break: break-all;">'
                + str + '</div>');
            var btnObj = $('<div class="open-footer"><span class="btn btn-ok">' + okText + '</span><span class="btn btn-cancel">' + cancelText + '</span></div>');
            textObj.attr('id', 'confirmDiv');
            btnObj.attr('id', 'closeBtn');
            btnObj.appendTo(textObj);
            btnObj.find("span").on('click', function () {
                closeDiv('confirmDiv');
                $(".confirmDiv").remove();
                if ($(this).hasClass("btn-cancel")) {
                    callback("cancel");
                }
                if ($(this).hasClass("btn-ok")) {
                    callback("ok");
                }
            });
            setTimeout(function () {
                textObj.appendTo("body");
                showDiv('confirmDiv');
            }, 200);
        }
        function confirmC(str, cancelText, okText, callback) {//右上角带 X 按钮的confirm， 点X 关闭后不执行回调函数
            if (jQuery.isFunction(cancelText)) {
                callback = cancelText;
                cancelText = "取消";
                okText = "确定";
            }
            var textObj = $('<div class="open-block warning confirmDiv"><span class="close_alert_icon"></span><h4 class="open-header"></h4><div class="open-body text-center" style="text-align:justify;word-break: break-all;"><span class="left">'
                + str + '</span></div>');
            var btnObj = $('<div class="open-footer"><span class="btn btn-cancel">' + cancelText + '</span><span class="btn btn-ok">' + okText + '</span></div>');
            textObj.attr('id', 'confirmDiv');
            btnObj.attr('id', 'closeBtn');
            btnObj.appendTo(textObj);
            btnObj.find("span").on('click', function () {
                closeDiv('confirmDiv');
                $(".confirmDiv").remove();
                if ($(this).hasClass("btn-cancel")) {
                    callback("cancel");
                }
                if ($(this).hasClass("btn-ok")) {
                    callback("ok");
                }
            });
            textObj.find(".close_alert_icon").on('click', function () {
            	closeDiv('confirmDiv');
                $(".confirmDiv").remove();
            });
            setTimeout(function () {
                textObj.appendTo("body");
                showDiv('confirmDiv');
            }, 200);
        }
        function showLoading(loadingInfo) {
            loadingInfo = loadingInfo || "系统正在加载数据，请稍等哟~";
            if ($("#loading").length == 0) {
                var loadingHtml = '<div class="" style="color:#fff" id="loading"><div class="loading"></div>' + loadingInfo + '</div>';
                var loadingObj = $(loadingHtml);
                loadingObj.appendTo("body");
                showDiv("loading");
                if (typeof (loadingTimeout) == "undefined" || loadingTimeout == null) {
                  let  loadingTimeout = setTimeout(function () {
                        hideLoading();
                        //    			alert("请求超时",function(){
                        ////    				lxRobotBridge.existApp();
                        //    			});
                    }, 5 * 60 * 1000);
                }
            } else {
                $("#loading").html('<div class="loading"></div>' + loadingInfo);
                showDiv("loading");
            }
        }

        function hideLoading() {
            closeDiv("loading");
            if (typeof (loadingTimeout) == "undefined" || loadingTimeout == null) {
              let  loadingTimeout = setTimeout(function () {
                    hideLoading();
                    //			alert("请求超时",function(){
                    ////				lxRobotBridge.existApp();
                    //			});
                }, 5 * 60 * 1000);
            }
        }
        function getParam(name) {
            // 如果链接没有参数，或者链接中不存在我们要获取的参数，直接返回空
            if (location.href.indexOf("?") == -1 || location.href.indexOf(name + '=') == -1) {
                return '';
            }
            // 获取链接中参数部分
            var queryString = location.href.substring(location.href.indexOf("?") + 1);
            try {
                queryString = decodeURI(queryString);
            } catch (e) {
                console.log(e);
            }
            // 分离参数对 ?key=value&key2=value2
            var parameters = queryString.split("&");
            var pos, paraName, paraValue;
            for (var i = 0; i < parameters.length; i++) {
                // 获取等号位置
                pos = parameters[i].indexOf('=');
                if (pos == -1) {
                    continue;
                }
                // 获取name 和 value
                paraName = parameters[i].substring(0, pos);
                paraValue = parameters[i].substring(pos + 1);
                // 如果查询的name等于当前name，就返回当前值，同时，将链接中的+号还原成空格
                if (paraName == name) {
                    // return unescape(paraValue.replace(/\+/g, " "));
                    return paraValue;
                }
            }
            return '';
        }
        // yyyy-MM-dd  yyyy/MM/dd
        Date.prototype.format = function (format) {
            var weekArray = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
            var o = {
                "M+": this.getMonth() + 1, //month
                "d+": this.getDate(), //day
                "D+": weekArray[this.getDay()], //week
                "h+": this.getHours(), //hour
                "m+": this.getMinutes(), //minute
                "s+": this.getSeconds(), //second
                "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
                "S": this.getMilliseconds() //millisecond
            }

            if (/(y+)/.test(format)) {
                format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
            }

            for (var k in o) {
                if (new RegExp("(" + k + ")").test(format)) {
                    format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
                }
            }
            return format;
        }


        /*获取人脸识别H5地址*/
        function getFaceAIH5(params,callback){
            var request = {
                name    : params.name.replace(/\s+/g, ""),
                idnum   : params.idnum,
                bqtype  : params.bqtype,
                from    : params.from,
                callBackUrl : encodeURI(params.callBackUrl)
            };
            base.ajax.post({
                url: '/smart-policykeeper-service/aiCode/faceurl',
                data: request,
                success: function success(resp) {
                    if ("0000"== resp.resCode){
                        if(callback){
                            callback(resp);
                        }else{
                            let url = resp.message;
                            var reg = new RegExp("(^|&)"+'orderNo'+"=([^&]*)(&|$)");
                            let search = url.substr(url.indexOf("?"));
                            var r = search.substr(1).match(reg);
                            if (r!=null){
                                var orderNo= unescape(r[2]);
                                sessionStorage.setItem("faceAIOrderNo",orderNo);
                                sessionStorage.setItem("faceAIStartTime", new Date().Format('yyyy-MM-dd hh:mm:ss'));
                            }
                            window.location.href = url;
                        }
                    }else{
                        alert("获取人脸识别信息失败！");
                    }
                },
                error: function (res) {
                    alert("获取人脸识别信息失败！");
                }
            })
        }
        /*获取人脸识别H5结果*/
        function getFaceAIH5Result(params,callback){
            let orderNo=params.orderNo || sessionStorage.getItem("faceAIOrderNo");
            var request = {
                name    : params.name.replace(/\s+/g, ""),
                idnum   : params.idnum,
                bqtype  : params.bqtype,
                from    : params.from,
                orderNo : orderNo
            };
            base.ajax.post({
                url: '/smart-policykeeper-service/aiCode/airesult',
                data: request,
                success: function success(resp) {
                    callback(resp);
                },
                error: function (resp) {
                    alert("查询人脸识别结果失败！");
                    callback(resp);
                }
            })
        }